

/**
 * @typedef DataOptions
 * @type {object}
 * @property {number} startTime - startTime timestamp like 1552579204000, required
 * @property {number} [endTime] - endTime timestamp like 1552579204000,if null, it contains subscribe
 * @property {number} sampleInterval -if <= 0, means it's tickdata
 * @property {number} [maxDataPoint] -this is only for tickData
 * @property {string} [businessHour] -
 * 
 */

 /**
 * @typedef RangeConfig
 * @type {object}
 * @property {string} rangeName -
 * @property {string[]} columnNames - 
 * @property {string[]} rowNames -
 * @property {string} orderby - ASC, DESC; default ASC
 * @property {string[]} [seriesName] -
 * 
 */

 /**
 * @typedef QueryConfig
 * @type {object}
 * @property {string} query -
 * @property {string} xValueField - 
 * @property {string} [fromClause] -
 * @property {string} [whereClause] -
 */

  /**
 * @typedef DirectionConfig
 * @type {object}
 * @property {string[]} tokens -
 * @property {string} [quarter] - 
 * @property {string} [ctd] -
 */



/**
 * @typedef RequestPayload
 * @type {object}
 * @property {string} [chartName] - chartName ,key, required
 * @property {string} [chartType] - chartType : line, OHLC
 * @property {string} [configSource] - configSource : Excel ,PTW, Mobile
 * @property {string} [chartTitle] - endTime timestamp like 1552579204000,required
 * @property {DataOptions} dataOptions - dataOptions
 * @property {QueryConfig[]} [queryConfigs] - queryConfigs
 * @property {RangeConfig[]} [rangeConfigs] - rangeConfigs 
 * @property {DirectionConfig[]} [directionConfigs] - directionConfigs
 * @property {object} [parameters] -  things that releated to client(like eletrcon)
 * @property {object} [chartOptions] -things related to highchart, like font size, line style
 */


/**
 * @typedef RequestContextOptions
 * @type {object}
 * @property {string} [requestId] - uuid for every request,if null, will generate 
 * @property {RequestPayload} payload - payload for request
 * 
 */


/**
 * @class RequestContext
 * @description RequestContext
 * @param {string} command -request command , config,intervalChange,zoomRequest
 * @param {RequestContextOptions}  options -
 */
function RequestContext(command,options){
    this.command = command;
    options = options || {};
    this.requestId = options.requestId || newUUID();
    this.payload = options || {};
}


RequestContext.command = {
    CONFIG:"config",
    INTERVAL_CHANGE:"intervalChange",
    ZOOM_REQUEST:"zoomRequest"

}